package com.cyq.day14.classWork2;

import java.util.Scanner;

public class Calc {
    Scanner scanner=new Scanner(System.in);
    public void Calc(){
        Point point1=new Point();
        Point point2=new Point();
        System.out.println("请输入一号点位的X坐标");
        double xp1=scanner.nextDouble();
        System.out.println("请输入一号点位的Y坐标");
        double yp1=scanner.nextDouble();
        System.out.println("请输入二号点位的X坐标");
        double xp2=scanner.nextDouble();
        System.out.println("请输入二号点位的Y坐标");
        double yp2=scanner.nextDouble();
        //Math.sqrt（x2-x1）(x2-x1)+(y2-y1)(y2-y1)
        double distance=Math.sqrt((xp2-xp1)*(xp2-xp1)+(yp2-yp1)*(yp2-yp1));
        System.out.println("两点的距离为："+distance);
    }
}
